package com.hotai.controller;

import com.hotai.comment.dtos.ResponseResult;
import com.hotai.comment.pojo.Institution;
import com.hotai.service.EquipmentService;
import com.hotai.vo.equipment.*;
import com.hotai.vo.userteacher.TearImprot;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
    @RequestMapping("/equipment")
@CrossOrigin
public class EquipmentController {
    @Autowired
    private EquipmentService equipmentService;


    //首页
    @RequestMapping("/list")
    private ResponseResult EuipmentList(EquipmentList query){
        return  equipmentService.EuipmentPage(query);

    }
//详情
    @RequestMapping("/detail")
    private ResponseResult EuipmentListDetaile(EquipmentDetileList queryware){
        return    equipmentService.Institutiondetail(queryware);
    }
//添加
    @RequestMapping("/save")
    private ResponseResult Institutioxsave(@RequestBody @Validated EquiomentsAdd equiomentsAdd){
        return    equipmentService.Euipmentsave(equiomentsAdd);
    }

    //修改SN码  内存(可用/总内存）系统版本号 ，安装的课程列表
    @RequestMapping("/Eupdate")
    private ResponseResult  EquipmenUpdate(@RequestBody EquiomenUpdate equiomentsAdd){
        return    equipmentService.EuipmentUpdate(equiomentsAdd);
    }

    //修改内存 版本号
    @RequestMapping("/EqWare")
    private ResponseResult  Equipmen(@RequestBody EquipmentWare equiomentsAdd  ){
        return    equipmentService.EuipmentWare(equiomentsAdd);
    }

//添加
    @RequestMapping("/AddBYid")
    private ResponseResult EuipmentListAddBYid(){
        return    equipmentService.EuipmentAddByid();
    }


//限制
    @RequestMapping("/xianzhi")
    private ResponseResult EuipmentListXian(@Param("id")Integer  id){
        return    equipmentService.EuipmentXian(id);
    }

    //管理端 全选限制
    @RequestMapping("/quanzhi")
    private ResponseResult EuipmentListXianhi(@Param("ide")String   ide){
        return    equipmentService.EuipmentXianZhi(ide);
    }

    //接触限制
    @RequestMapping("/relieve")
    private ResponseResult EuipmentListrelieve(@Param("id")Integer  id){
        return    equipmentService.Euipmentrelieve(id);
    }

    //管理端 多选接触限制
    @RequestMapping("/eqrelieve")
    private ResponseResult EuipmentListeqrelieve(@Param("ide")String   ide){
        return    equipmentService.Euipmenteqrelieve(ide);
    }



    @RequestMapping("/Daochu")
    private ResponseResult TearDaochu(HttpServletRequest request, HttpServletResponse response) {
        return equipmentService.Daochu(request, response);
    }

    @RequestMapping("/import")
    public ResponseResult TearImprot(HttpServletRequest request, HttpServletResponse response, MultipartFile file) throws Exception {
        return equipmentService.improtStu(request, response, file);
    }

    @RequestMapping("/importAdd")
    public ResponseResult TearImprotAdd(@RequestBody EqImportAdd eqImportAdd  ){
        return equipmentService.improtAdd(eqImportAdd);
    }

}
